/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nus.application.web.file;

import com.nus.application.ejb.conference.ConferenceSubmitEjbLocal;
import com.nus.application.web.base.BaseAction;
import com.nus.dataaccess.dao.conference.ConferenceItem;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import javax.inject.Inject;

/**
 *
 * @author robin.foe
 */
public class FileManager extends BaseAction{
    
    private InputStream inputStream;
    public InputStream getInputStream(){return this.inputStream;} 
    
    
    private ConferenceItem conferenceItem = new ConferenceItem();
    public ConferenceItem getConferenceItem() {return conferenceItem;}
    public void setConferenceItem(ConferenceItem conferenceItem) {this.conferenceItem = conferenceItem;}
    
    
    @Inject
    ConferenceSubmitEjbLocal conferenceSubmitEjb;
    
    public String doDownload(){
        conferenceItem = conferenceSubmitEjb.getConferenceItem(conferenceItem.getId());
        this.inputStream = new ByteArrayInputStream(conferenceItem.getFileBinary());
        return SUCCESS;
    }
    
    
}
